import { Injectable } from '@angular/core';
import { Subject } from 'rxjs/Subject';
import { Observable } from 'rxjs/Observable';
@Injectable()
export class DataService {
    /**
     * 组件 -组件的数据沟通
     */
    private data: any;
    private nav: any;
    private actType: any;
    private rechType:any;
    private rechMulti:any;
    private subject: Subject<any> = new Subject<any>();
    private navsubject: Subject<any> = new Subject<any>();
    private rechTypeject:Subject<any>=new Subject<any>();
    private rechMultiject:Subject<any>=new Subject<any>();
    setData(data: any): void {
        this.data = data;
        this.subject.next(data);
    }

    getData(): Observable<any> {
        return this.subject.asObservable();
    }

    setNav(data: any): void {
        this.nav = data;
        this.navsubject.next(data);
    }

    getNav(): Observable<any> {
        return this.navsubject.asObservable();
    }

    
}
